package com.zhihaihe.file.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhihaihe.file.dto.sharefile.ShareListDTO;
import com.zhihaihe.file.mapper.ShareMapper;
import com.zhihaihe.file.pojo.Share;
import com.zhihaihe.file.service.IShareService;
import com.zhihaihe.file.vo.share.ShareListVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShareImpl  extends ServiceImpl<ShareMapper, Share> implements IShareService {
    @Autowired
    ShareMapper shareMapper;
    @Override
    public List<ShareListVO> selectShareList(ShareListDTO shareListDTO, Long userId) {
        Long beginCount = (shareListDTO.getCurrentPage() - 1) * shareListDTO.getPageCount();
        return shareMapper.selectShareList(shareListDTO.getShareFilePath(),
                shareListDTO.getShareBatchNum(),
                beginCount, shareListDTO.getPageCount(), userId);
    }

    @Override
    public int selectShareListTotalCount(ShareListDTO shareListDTO, Long userId) {
        return shareMapper.selectShareListTotalCount(shareListDTO.getShareFilePath(), shareListDTO.getShareBatchNum(), userId);
    }
}
